package controllers;

import java.util.List;

import models.Post;

import org.eclipse.mylyn.wikitext.core.parser.MarkupParser;

import play.data.validation.Valid;
import play.mvc.Controller;

public class Application extends Controller {

	public static void index() {
		List<Post> posts = Post.all().fetch();
		render(posts);
	}
	
	
	public static void show(long  id){
		Post post = Post.findById(id);
		render(post);
		MarkupParser parser  = new MarkupParser();
		
		
	}
	
	

	public static void post(@Valid Post post) {
		if (validation.hasErrors()) {
			params.flash();
			validation.keep();
			index();
		} else {
			post.insert();
			index();
		}
		index();
	}

}